#ifndef WIDGET_H
#define WIDGET_H


#include <QWidget>
#include <QComboBox>
#include <QLayout>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QRegExp>
#include <QMessageBox>
#include <QButtonGroup>

#include "dico.h"
#include "config.h"
#include "letteredit.h"



//----------
namespace Ui
{
    class Widget;
}
//-----------------------------
class Widget : public QWidget
{

        Q_OBJECT

    private:
        Ui::Widget *ui;

        QList<LetterEdit*> m_letterList;
        Dico* m_dico;
        QStringList m_resultList;
        QStringList m_advancedResultList;

        Config*	m_config;

        QSystemTrayIcon* m_systemTrayIcon;
        QMenu* m_STIMenu;

        void prepareAdvancedResults ();
        int m_msTimeCalc;

    public:
        Widget (QWidget *parent = 0);
        ~Widget ();

    private slots:

        void resizeCb (int num);
        void find ();
        void onAddTheWordClicked ();
        void onWordToAddChanged (const QString& newWord);
        void onDicoMessage (const QString &);
        void onDicoError (const QString &);
        void setMinMaxLength (int min, int max);
        void onClearButtonClicked ();
        void onSystemTrayIconActivated (QSystemTrayIcon::ActivationReason);
        void onCopyButtonClicked ();
        void onAdvancedCopyButtonClicked ();

        void onAdvancedSearchClicked ();
        void onCurrentTabChanged (int);
        void onAdvancedClearButtonClicked ();
        void onChooseRefDicClicked ();
        void onRefDicsListCurrentChanged (const QString &newCurrent);
        void onAddADicClicked ();

        void onSearchOptionsCurrentIndexChanged (const int index);

        void onDicoXMessage (const bool extended, const QStringList &fromDico, const QString& txt);

        void onClearAllDics ();
        void onSaveRefDic ();

        void onDicoInitCalc (const int max);
        void onDicoProgress (const int step);
        void onDicoStopCalc (const int msElapsed);
};

#endif // WIDGET_H
